package cn.itcast.storage.web;

import cn.itcast.storage.api.StorageClient;
import cn.itcast.storage.service.StorageService;
import org.orz.cloud.common.result.ResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 虎哥
 */
@RestController
public class StorageProvider implements StorageClient {

    @Autowired
    private StorageService storageService;


    /**
     * 扣减库存
     * @param code 商品编号
     * @param count 要扣减的数量
     * @return 无
     */
    @Override
    public ResultDTO deduct(String code, Integer count){
        storageService.deduct(code, count);
        return ResultDTO.success();
    }
}
